<?php
namespace Api\Controller;
use Think\Controller;
class InforController extends BaseController {


  /**
   *   提交信息
   * @param $name,$phone,$user_id,$aid
   * @return \json_encode
   */
  public function subInfor(){


      $name = $_POST['name'];
      $phone = $_POST['phone'];
      $user_id = $_POST['user_id'];
      $aid = $_POST['aid'];

      if(!$name || !$phone ||!$user_id || !$aid){
          echo json_encode(array('status'=>404,'err'=>'数据传递失败！'));
      }
      $data['name'] = $name;
      $data['phone'] = $phone;
      $data['user_id'] = $user_id;
      $data['aid'] = $aid;
      $list = M('ac_user')->where($data)->select();
      if($list){
          echo json_encode(array('status'=>201,'err'=>'请勿重复提交！'));
      }

      $a_list = M('ac_user')->add($data);
      if($a_list){
          echo json_encode(array('status'=>200,'err'=>'提交成功！'));
      }else{
          echo json_encode(array('status'=>203,'err'=>'提交失败，请重新提交！'));
      }
  }



    /**
     *   获取展示信息内容
     */
    public function showDetail(){
        $id = $_REQUEST['id'];
        $list = M('infor')->where("id = '$id'")->find();
        $aImage = $list['imagea'];
        if($aImage){
            echo json_encode(array('aImage'=>$aImage));
        }else{
            echo json_encode(array('status'=>203,'err'=>'提交失败，请重新提交！'));
        }

    }


}
